package com.pubinfo.passbook.api.controller.auth;

import com.pubinfo.passbook.common.entity.TRuleGenus;
import com.pubinfo.passbook.common.model.dto.rule.RuleGenusParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.TRuleGenusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("genus/manager")
@Api(tags = "供属信息管理")
public class TGenusController {
  
  @Resource
  private TRuleGenusService genusService;
  
  @PostMapping(value = "select")
  @ApiModelProperty(value = "查询供属信息")
  public JsonResult<MyPage<TRuleGenus>> selectRuleGenus(@RequestBody RuleGenusParam param) {
    return JsonResult.success(new MyPage(genusService.selectRuleGenus(param)));
  }
  
  @PostMapping(value = "delete")
  @ApiModelProperty(value = "删除供属信息")
  public JsonResult<Boolean> deleteRuleGenus(String id) {
    return JsonResult.success(genusService.deleteRuleGenus(id));
  }
  
  @PostMapping(value = "save")
  @ApiModelProperty(value = "新增供属信息")
  public JsonResult<Boolean> saveRuleGenus(@RequestBody TRuleGenus tRuleGenus) {
    return JsonResult.success(genusService.saveRuleGenus(tRuleGenus));
  }
}
